package io.renren.modules.footprint.service.impl;

import io.renren.common.utils.R;
import io.renren.modules.footprint.entity.VipfootprintinfosCustomEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import io.renren.modules.footprint.dao.VipfootprintinfosDao;
import io.renren.modules.footprint.entity.VipfootprintinfosEntity;
import io.renren.modules.footprint.service.VipfootprintinfosService;



/**
 * @author 黄清
 */
@Service("vipfootprintinfosService")
public class VipfootprintinfosServiceImpl implements VipfootprintinfosService {
	@Autowired
	private VipfootprintinfosDao vipfootprintinfosDao;

	@Override
	public int deleteByProject(String[] targetid) {
		return vipfootprintinfosDao.deleteByProject(targetid);
	}

	@Override
	public int deleteByUser(String[] userinfoid) {
		return vipfootprintinfosDao.deleteByUser(userinfoid);
	}

	@Override
	public int queryApiTotal(Map<String, Object> map) {
		return vipfootprintinfosDao.queryApiTotal(map);
	}

	@Override
	public List<VipfootprintinfosCustomEntity> queryApiList(Map<String, Object> map) {
		return vipfootprintinfosDao.queryApiList(map);
	}

	@Override
	public VipfootprintinfosEntity queryObject(String  vipfootprintinfoid){
		return vipfootprintinfosDao.queryObject( vipfootprintinfoid);
	}

	@Override
	public VipfootprintinfosCustomEntity queryCustomInfo(String vipfootprintinfoid) {
		return vipfootprintinfosDao.queryCustomInfo(vipfootprintinfoid);
	}

	@Override
	public List<VipfootprintinfosEntity> queryList(Map<String, Object> map){
		return vipfootprintinfosDao.queryList(map);
	}

	@Override
	public List<VipfootprintinfosCustomEntity> queryCustomList(Map<String, Object> map) {
		return vipfootprintinfosDao.queryCustomList(map);
	}

	@Override
	public int queryTotal(Map<String, Object> map){
		return vipfootprintinfosDao.queryTotal(map);
	}

	@Override
	public int queryCustomTotal(Map<String, Object> map) {
		return vipfootprintinfosDao.queryCustomTotal(map);
	}

	@Override
	public void save(VipfootprintinfosEntity vipfootprintinfos){
		//设置id
		String id = UUID.randomUUID().toString().replaceAll("-", "");
		vipfootprintinfos.setvipfootprintinfoid(id);
		//设置创建时间
		vipfootprintinfos.setCreatetime(new Date());
		vipfootprintinfosDao.save(vipfootprintinfos);
	}
	
	@Override
	public void update(VipfootprintinfosEntity vipfootprintinfos){
		vipfootprintinfosDao.update(vipfootprintinfos);
	}
	
	@Override
	public void delete(String  vipfootprintinfoid){
		vipfootprintinfosDao.delete( vipfootprintinfoid);
	}
	
	@Override
	public void deleteBatch(String[]  vipfootprintinfoids){
		vipfootprintinfosDao.deleteBatch( vipfootprintinfoids);
	}

	@Override
	public R judgeFoodprintExistByUser(VipfootprintinfosEntity vipfootprintinfosEntity) {
		int existByUser = vipfootprintinfosDao.judgeFoodprintExistByUser(vipfootprintinfosEntity);
		if(existByUser == 0){
			return R.error("无法查看项目");
		}
		return null;
	}

}
